$(document).ready(function () {

    $('#resourceSend').click(function () {
        if ($("#resourceForm").valid()) {
            var sHTML = $('#summernote').code();
            $('#resourceContent').val(sHTML);
            $.ajax({
                data: $('#resourceForm').serializeArray(),
                type: "POST",
                url: ctx + "/resource",
                dataType: "json",
                success: function (data) {
                    alert(data.msg);
                }
            });
        }

    });

});
function handleFiles(files) {
    data = new FormData();
    data.append("file", files[0]);
    data.append("token", "2liIyhpQX6QXv-tFS6HpWGWnAD6J4M8bRKOaDMKv:zjGSlI9tXPxicotT15kPp79N99o=:eyJzY29wZSI6InlhbmdzaiIsImRlYWRsaW5lIjozMjE2MzMyMzUwfQ==");
    url = "http://upload.qiniu.com/"
    $.ajax({
        data: data,
        type: "POST",
        url: url,
        cache: false,
        contentType: false,
        processData: false,
        success: function (data) {
            if (data != "") {
                $("#pic").val("http://7xjcjk.com1.z0.glb.clouddn.com/" + data.key);
            } else {
                alert("图片上传失败");
            }

        }
    });
}
